home *** CD-ROM | disk | FTP | other *** search
-
- -----------------------------------------
- -- INTRO IMAGE BOX
- -----------------------------------------
-
- -- DON'T Set these directly:
- IntroZoomSize = true
- IntroImageColor = Color(1,1,1,1)
- IntroImageSize = Vector3(0.75, 0.75, 0 )
-
- function FadeOut( fadeTime )
- IntroZoomSize = false
- SetImagePopupTiming( fadeTime, 10, 0.05 );
- IntroImageSize = Vector3(2, 2, 0 )
- IntroImagePopup( "Textures/Black.bmp" )
- end
-
- function FadeIn( fadeTime )
- IntroZoomSize = false
- SetImagePopupTiming( 0, 0.05, fadeTime );
- IntroImageSize = Vector3(2, 2, 0 )
- IntroImagePopup( "Textures/Black.bmp" )
- end
-
- function SetImagePopupTiming( inTime, waitTime, outTime )
- ImageFadeInDur = inTime;
- ImageWaitDur = waitTime;
- ImageFadeOutDur = outTime;
- TotalImageDur = ImageFadeInDur + ImageWaitDur + ImageFadeOutDur
- end
-
- SetImagePopupTiming( 0.5, 0.75, 0.75 );
-
- function KillImagePopup()
- if( IntroImage ~= nil and IntroImage.IsValid() ) then
- IntroImage.Destroy();
- end
- end
-
- function IntroImagePopup( imageName )
- if( IntroImage == nil or not(IntroImage.IsValid()) ) then
- G.Create( "MenuData/IntroImageCog.xml" );
- end
-
- IntroImage.SetGuiPosition( "IntroImageBox", Vector3(0,0,0) );
- IntroImage.Message( "IntroImageBox", "setimage", imageName );
-
- IntroImageColor[3] = 0;
- if( ImageFadeInDur == 0 ) then
- IntroImageColor[3] = 1
- end
-
- IntroImage.SetColor( "IntroImageBox", IntroImageColor );
-
- if( IntroZoomSize ) then
- IntroImage.SetGuiSize("IntroImageBox", Vector3(0,0,0) );
- else
- IntroImage.SetGuiSize("IntroImageBox", IntroImageSize );
- end
-
- ImageFadeTime = TotalImageDur
- end
-
- function ColorImagePopup( imageName, color )
-
- IntroImageColor = color
- IntroImagePopup( imageName )
- end
-
-
- function ImageFadeFunc()
- -- Fade image over time
- if( IntroImage ~= nil and IntroImage.IsValid() ) then
- ImageFadeTime = ImageFadeTime - GameTimeDiff;
-
- -- First Fade in:
- if( ImageFadeTime > ImageWaitDur + ImageFadeOutDur ) then
- IntroImageColor[3] = (TotalImageDur - ImageFadeTime) / ImageFadeInDur;
- else
- if( ImageFadeTime > ImageFadeOutDur ) then
- IntroImageColor[3] = 1;
- else
- IntroImageColor[3] = ImageFadeTime / ImageFadeOutDur;
- end
- end
-
- -- Pop the text box too:
- local curSize = Vector3(0,0,0)
-
- if( IntroZoomSize ) then
- curSize[0] = IntroImageSize[0] * IntroImageColor[3]
- curSize[1] = IntroImageSize[1] * IntroImageColor[3]
- curSize[2] = IntroImageSize[2] * IntroImageColor[3]
- else
- curSize[0] = IntroImageSize[0]
- curSize[1] = IntroImageSize[1]
- curSize[2] = IntroImageSize[2]
- end
-
- IntroImage.SetGuiSize( "IntroImageBox", curSize );
- IntroImage.SetColor( "IntroImageBox", IntroImageColor );
-
- if( ImageFadeTime < 0 ) then
- KillImagePopup()
- end
- end
- end
-
- -- Always update Function:
- GMain[ "ImageFadeFunc" ] = ImageFadeFunc;
-